导出CSV

导入CSV

1
2
LOAD CSV WITH HEADERS FROM "file:///c:/node_test.csv" AS item
MERGE (n:Person {id:toInteger(item.id), name: item.name})
1
2
3
LOAD CSV WITH HEADERS FROM "file:///director_relation.csv" AS line
MATCH (from:Director{id:toInteger(line.directorId)}),(to:Movie{id:toInteger(line.movieId)})
MERGE (from)-[r:DIRECTED{id:toInteger(line.directorId),id:toInteger(line.movieId)}]->(to)

参考

1
2
3
4
https://blog.csdn.net/a772316182/article/details/82912961
http://www.cnblogs.com/hwaggLee/p/5959716.html
https://www.sogou.com/tupu/person.html 搜狗人物关系
https://blog.csdn.net/qq_31748587/article/details/84286411 neo4j图形数据库第三弹——整合springboot(支持查询多节点)
1
2


neo4j-admin导入

student.csv

1
2
3
id,name
1,s1
2,s2

Bolt

1
https://blog.csdn.net/zhanaolu4821/article/details/80940598
1
2
tx.run("CREATE (n:Movie{NAME:{NAME}, TITLE:{TITLE}})",
Values.parameters("NAME", "james", "TITLE", "King"));
1
2
3
4
5
6
tx.run("MATCH (p1:Person { id: {id1} }), (p2:Person {id: {id2} }) " +
"CREATE (p1)-[r: {relationName} {type: {relationType} }]->(p2)",
Values.parameters("id1", 1,
"id2", 2,
"relationName", "绯闻",
"relationType", "2"));

添加关系测试

1
2
3
4
CREATE (t1:Teacher {id:1, name:"t1"})
CREATE (s1:Student {id:1, name:"s1"})
MATCH (t:Teacher {id: 1}), (s:Student {id: 1})
CREATE (t)-[r:绯闻{type: 0}]->(s)
panchaoxin wechat
关注我的公众号
支持一下